package com.kuang.method;

/**
 * @author wuJiaWei
 * @version 1.0
 * @date 2024/8/9
 * @time 14:52:32
 */
public class Demo05 {

    //通过阶程数计算演示
    public static void main(String[] args) {
        System.out.println(f(4));
    }

    //1! 1
    //2! 2*1
    //3! 3*2*1
    //n! n*(n-1)*(n-2)*...*1
    public static int f(int n){
        if (n == 1){
            return 1;
        }else{
            return n*f(n-1);
        }
    }
}
